// Copyright (c) 2019 Presto Labs Pte. Ltd.
// Author: xguo

#include "coin2/exchange/huobi/symbology/currency.h"

#include <gtest/gtest.h>

TEST(HuobiCurrency, constructor) {
  using coin2::exchange::base::market::ExchangeType;
  using coin2::exchange::base::market::MarketType;
  using coin2::exchange::huobi::symbology::HuobiCurrency;

  int64_t resolve_ts = 1572502253 * 1e9;

  HuobiCurrency usdt("USDT");
  EXPECT_EQ(usdt.currency(), "USDT");
  EXPECT_EQ(usdt.native_currency(), "usdt");
  EXPECT_EQ(usdt.rep_currency(), "USD");
  EXPECT_EQ(usdt.exchange(), ExchangeType::Huobi);

  auto btc1 = HuobiCurrency::FromNativeStr("btc", resolve_ts);  // spot
  EXPECT_EQ(btc1.currency(), "BTC");
  EXPECT_EQ(btc1.native_currency(), "btc");
  EXPECT_EQ(btc1.native_currency(), "btc");
  EXPECT_EQ(btc1.exchange(), ExchangeType::Huobi);

  auto btc2 = HuobiCurrency::FromNativeStr("BTC", resolve_ts);  // futures
  EXPECT_EQ(btc2.native_currency(), "btc");
  auto btc3 = HuobiCurrency::FromNormStr("BTC", resolve_ts);
  auto btc4 = HuobiCurrency::FromStr("BTC", resolve_ts);
  auto btc5 = HuobiCurrency::FromStr("btc", resolve_ts);
  EXPECT_EQ(btc2, btc1);
  EXPECT_EQ(btc3, btc1);
  EXPECT_EQ(btc4, btc1);
  EXPECT_EQ(btc5, btc1);

  auto bsv = HuobiCurrency::FromStr("BSV", resolve_ts);
  EXPECT_EQ(bsv.currency(), "BCHSV");
  EXPECT_EQ(bsv.native_currency(), "bsv");

  auto bch = HuobiCurrency::FromStr("BCH", resolve_ts);
  EXPECT_EQ(bch.currency(), "BCHABC");
  EXPECT_EQ(bch.native_currency(), "bch");
}
